HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpbiancoarte/wp-content/themes/hiroshi/inc/filter/helper.php
<?php

if ( ! function_exists( 'hiroshi_get_filter_items' ) ) {
	/**
	 * Function that return filter items from query parameters
	 *
	 * @param array $params - options value
	 *
	 * @return array
	 */
	function hiroshi_get_filter_items( $params ) {
		$taxonomy = isset( $params['taxonomy_filter'] ) && ! empty( $params['taxonomy_filter'] ) ? esc_attr( $params['taxonomy_filter'] ) : 'category';

		// Check is taxonomy set through option and set that value instead of the default one
		if ( isset( $params['tax'] ) && ! empty( $params['tax'] ) ) {
			$taxonomy = esc_attr( $params['tax'] );
		}

		$custom_query = false;

		$args = array(
			'taxonomy' => $taxonomy,
		);

		if ( isset( $params['tax_slug'] ) && ! empty( $params['tax_slug'] ) ) {
			$custom_query      = true;
			$specific_taxonomy = get_term_by( 'slug', esc_attr( $params['tax_slug'] ), $taxonomy );

			if ( isset( $specific_taxonomy->term_id ) && '' !== $specific_taxonomy->term_id ) {
				$child_taxonomies = get_term_children( $specific_taxonomy->term_id, $taxonomy );

				if ( ! empty( $child_taxonomies ) ) {
					$args['include'] = $child_taxonomies;
				} else {
					$args['slug'] = esc_attr( $params['tax_slug'] );
				}
			}
		}

		if ( isset( $params['tax__in'] ) && ! empty( $params['tax__in'] ) ) {
			$custom_query    = true;
			$args['include'] = explode( ',', str_replace( ' ', '', $params['tax__in'] ) );
		}

		if ( ! $custom_query ) {
			$args['parent'] = 0;
		}

		$terms = get_terms( $args );
		$items = ! empty( $terms ) ? $terms : '';

		return apply_filters( 'hiroshi_filter_get_filter_items', $items, $params );
	}
}